library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity generated_controller_tb is
end entity generated_controller_tb;

architecture tb of generated_controller_tb is

	------------------------------------------------------------------------------------------
	--
	-- components
	--
	-- components used are defined here
	--
	------------------------------------------------------------------------------------------

	component link_controller is

		port ( clk               : in  std_logic;
		       host_address      : in  std_logic_vector(23 DownTo 0);
		       pixel_value       : in  std_logic;
		       data_in_n         : in  std_logic;
		       data_in_ne        : in  std_logic;
		       data_in_nw        : in  std_logic;
		       data_in_s         : in  std_logic;
		       data_in_se        : in  std_logic;
		       data_in_sw        : in  std_logic;
		       data_in_e         : in  std_logic;
		       data_in_w         : in  std_logic;
		       data_out_n        : out std_logic;
		       data_out_ne       : out std_logic;
		       data_out_nw       : out std_logic;
		       data_out_s        : out std_logic;
		       data_out_se       : out std_logic;
		       data_out_sw       : out std_logic;
		       data_out_e        : out std_logic;
		       data_out_w        : out std_logic;
		       links_complete    : out std_logic;
		       controller_label  : out std_logic_vector(23 DownTo 0)
		     );

	end component;

	component link_physical is 

		port ( link_a    : in  std_logic;
		       link_b    : in  std_logic;
		       or_out    : out std_logic
		     );

	end component;

	------------------------------------------------------------------------------------------
	--
	-- global signals
	--
	-- all global signals used across controllers are defined here
	-- 
	------------------------------------------------------------------------------------------

	signal controller_clk                            : std_logic;

	------------------------------------------------------------------------------------------
	--
	-- controller link signals
	--
	-- the physical links between each controller
	-- 
	------------------------------------------------------------------------------------------

	-- controller b0
	signal controller_b0_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b0_pixel                       : std_logic;
	signal controller_b0_complete                    : std_logic;
	signal controller_b0_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b0_n                              : std_logic;
	signal ph_loop_b0_ne                             : std_logic;
	signal ph_loop_b0_nw                             : std_logic;
	signal ph_link_b0_b5                             : std_logic;
	signal ph_link_b0_1                              : std_logic;
	signal ph_loop_b0_sw                             : std_logic;
	signal ph_link_b0_b1                             : std_logic;
	signal ph_loop_b0_w                              : std_logic;
	signal link_b0_out_n                             : std_logic;
	signal link_b0_out_ne                            : std_logic;
	signal link_b0_out_nw                            : std_logic;
	signal link_b0_out_s                             : std_logic;
	signal link_b0_out_se                            : std_logic;
	signal link_b0_out_sw                            : std_logic;
	signal link_b0_out_e                             : std_logic;
	signal link_b0_out_w                             : std_logic;

	-- controller b1
	signal controller_b1_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b1_pixel                       : std_logic;
	signal controller_b1_complete                    : std_logic;
	signal controller_b1_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b1_n                              : std_logic;
	signal ph_loop_b1_ne                             : std_logic;
	signal ph_loop_b1_nw                             : std_logic;
	signal ph_link_b1_1                              : std_logic;
	signal ph_link_b1_2                              : std_logic;
	signal ph_link_b1_b5                             : std_logic;
	signal ph_link_b1_b2                             : std_logic;
	signal link_b1_out_n                             : std_logic;
	signal link_b1_out_ne                            : std_logic;
	signal link_b1_out_nw                            : std_logic;
	signal link_b1_out_s                             : std_logic;
	signal link_b1_out_se                            : std_logic;
	signal link_b1_out_sw                            : std_logic;
	signal link_b1_out_e                             : std_logic;
	signal link_b1_out_w                             : std_logic;

	-- controller b2
	signal controller_b2_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b2_pixel                       : std_logic;
	signal controller_b2_complete                    : std_logic;
	signal controller_b2_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b2_n                              : std_logic;
	signal ph_loop_b2_ne                             : std_logic;
	signal ph_loop_b2_nw                             : std_logic;
	signal ph_link_b2_2                              : std_logic;
	signal ph_link_b2_3                              : std_logic;
	signal ph_link_b2_1                              : std_logic;
	signal ph_link_b2_b3                             : std_logic;
	signal link_b2_out_n                             : std_logic;
	signal link_b2_out_ne                            : std_logic;
	signal link_b2_out_nw                            : std_logic;
	signal link_b2_out_s                             : std_logic;
	signal link_b2_out_se                            : std_logic;
	signal link_b2_out_sw                            : std_logic;
	signal link_b2_out_e                             : std_logic;
	signal link_b2_out_w                             : std_logic;

	-- controller b3
	signal controller_b3_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b3_pixel                       : std_logic;
	signal controller_b3_complete                    : std_logic;
	signal controller_b3_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b3_n                              : std_logic;
	signal ph_loop_b3_ne                             : std_logic;
	signal ph_loop_b3_nw                             : std_logic;
	signal ph_link_b3_3                              : std_logic;
	signal ph_link_b3_b6                             : std_logic;
	signal ph_link_b3_2                              : std_logic;
	signal ph_link_b3_b4                             : std_logic;
	signal link_b3_out_n                             : std_logic;
	signal link_b3_out_ne                            : std_logic;
	signal link_b3_out_nw                            : std_logic;
	signal link_b3_out_s                             : std_logic;
	signal link_b3_out_se                            : std_logic;
	signal link_b3_out_sw                            : std_logic;
	signal link_b3_out_e                             : std_logic;
	signal link_b3_out_w                             : std_logic;

	-- controller b4
	signal controller_b4_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b4_pixel                       : std_logic;
	signal controller_b4_complete                    : std_logic;
	signal controller_b4_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b4_n                              : std_logic;
	signal ph_loop_b4_ne                             : std_logic;
	signal ph_loop_b4_nw                             : std_logic;
	signal ph_link_b4_b6                             : std_logic;
	signal ph_loop_b4_se                             : std_logic;
	signal ph_link_b4_3                              : std_logic;
	signal ph_loop_b4_e                              : std_logic;
	signal link_b4_out_n                             : std_logic;
	signal link_b4_out_ne                            : std_logic;
	signal link_b4_out_nw                            : std_logic;
	signal link_b4_out_s                             : std_logic;
	signal link_b4_out_se                            : std_logic;
	signal link_b4_out_sw                            : std_logic;
	signal link_b4_out_e                             : std_logic;
	signal link_b4_out_w                             : std_logic;

	-- controller b5
	signal controller_b5_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b5_pixel                       : std_logic;
	signal controller_b5_complete                    : std_logic;
	signal controller_b5_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b5_nw                             : std_logic;
	signal ph_link_b5_b7                             : std_logic;
	signal ph_link_b5_4                              : std_logic;
	signal ph_loop_b5_sw                             : std_logic;
	signal ph_link_b5_1                              : std_logic;
	signal ph_loop_b5_w                              : std_logic;
	signal link_b5_out_n                             : std_logic;
	signal link_b5_out_ne                            : std_logic;
	signal link_b5_out_nw                            : std_logic;
	signal link_b5_out_s                             : std_logic;
	signal link_b5_out_se                            : std_logic;
	signal link_b5_out_sw                            : std_logic;
	signal link_b5_out_e                             : std_logic;
	signal link_b5_out_w                             : std_logic;

	-- controller 1
	signal controller_1_address                      : std_logic_vector(23 DownTo 0);
	signal controller_1_pixel                        : std_logic;
	signal controller_1_complete                     : std_logic;
	signal controller_1_f_label                      : std_logic_vector(23 DownTo 0);
	signal ph_link_1_4                               : std_logic;
	signal ph_link_1_5                               : std_logic;
	signal ph_link_1_b7                              : std_logic;
	signal ph_link_1_2                               : std_logic;
	signal link_1_out_n                              : std_logic;
	signal link_1_out_ne                             : std_logic;
	signal link_1_out_nw                             : std_logic;
	signal link_1_out_s                              : std_logic;
	signal link_1_out_se                             : std_logic;
	signal link_1_out_sw                             : std_logic;
	signal link_1_out_e                              : std_logic;
	signal link_1_out_w                              : std_logic;

	-- controller 2
	signal controller_2_address                      : std_logic_vector(23 DownTo 0);
	signal controller_2_pixel                        : std_logic;
	signal controller_2_complete                     : std_logic;
	signal controller_2_f_label                      : std_logic_vector(23 DownTo 0);
	signal ph_link_2_5                               : std_logic;
	signal ph_link_2_6                               : std_logic;
	signal ph_link_2_4                               : std_logic;
	signal ph_link_2_3                               : std_logic;
	signal link_2_out_n                              : std_logic;
	signal link_2_out_ne                             : std_logic;
	signal link_2_out_nw                             : std_logic;
	signal link_2_out_s                              : std_logic;
	signal link_2_out_se                             : std_logic;
	signal link_2_out_sw                             : std_logic;
	signal link_2_out_e                              : std_logic;
	signal link_2_out_w                              : std_logic;

	-- controller 3
	signal controller_3_address                      : std_logic_vector(23 DownTo 0);
	signal controller_3_pixel                        : std_logic;
	signal controller_3_complete                     : std_logic;
	signal controller_3_f_label                      : std_logic_vector(23 DownTo 0);
	signal ph_link_3_6                               : std_logic;
	signal ph_link_3_b8                              : std_logic;
	signal ph_link_3_5                               : std_logic;
	signal ph_link_3_b6                              : std_logic;
	signal link_3_out_n                              : std_logic;
	signal link_3_out_ne                             : std_logic;
	signal link_3_out_nw                             : std_logic;
	signal link_3_out_s                              : std_logic;
	signal link_3_out_se                             : std_logic;
	signal link_3_out_sw                             : std_logic;
	signal link_3_out_e                              : std_logic;
	signal link_3_out_w                              : std_logic;

	-- controller b6
	signal controller_b6_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b6_pixel                       : std_logic;
	signal controller_b6_complete                    : std_logic;
	signal controller_b6_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b6_ne                             : std_logic;
	signal ph_link_b6_b8                             : std_logic;
	signal ph_loop_b6_se                             : std_logic;
	signal ph_link_b6_6                              : std_logic;
	signal ph_loop_b6_e                              : std_logic;
	signal link_b6_out_n                             : std_logic;
	signal link_b6_out_ne                            : std_logic;
	signal link_b6_out_nw                            : std_logic;
	signal link_b6_out_s                             : std_logic;
	signal link_b6_out_se                            : std_logic;
	signal link_b6_out_sw                            : std_logic;
	signal link_b6_out_e                             : std_logic;
	signal link_b6_out_w                             : std_logic;

	-- controller b7
	signal controller_b7_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b7_pixel                       : std_logic;
	signal controller_b7_complete                    : std_logic;
	signal controller_b7_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b7_nw                             : std_logic;
	signal ph_link_b7_b9                             : std_logic;
	signal ph_link_b7_7                              : std_logic;
	signal ph_loop_b7_sw                             : std_logic;
	signal ph_link_b7_4                              : std_logic;
	signal ph_loop_b7_w                              : std_logic;
	signal link_b7_out_n                             : std_logic;
	signal link_b7_out_ne                            : std_logic;
	signal link_b7_out_nw                            : std_logic;
	signal link_b7_out_s                             : std_logic;
	signal link_b7_out_se                            : std_logic;
	signal link_b7_out_sw                            : std_logic;
	signal link_b7_out_e                             : std_logic;
	signal link_b7_out_w                             : std_logic;

	-- controller 4
	signal controller_4_address                      : std_logic_vector(23 DownTo 0);
	signal controller_4_pixel                        : std_logic;
	signal controller_4_complete                     : std_logic;
	signal controller_4_f_label                      : std_logic_vector(23 DownTo 0);
	signal ph_link_4_7                               : std_logic;
	signal ph_link_4_8                               : std_logic;
	signal ph_link_4_b9                              : std_logic;
	signal ph_link_4_5                               : std_logic;
	signal link_4_out_n                              : std_logic;
	signal link_4_out_ne                             : std_logic;
	signal link_4_out_nw                             : std_logic;
	signal link_4_out_s                              : std_logic;
	signal link_4_out_se                             : std_logic;
	signal link_4_out_sw                             : std_logic;
	signal link_4_out_e                              : std_logic;
	signal link_4_out_w                              : std_logic;

	-- controller 5
	signal controller_5_address                      : std_logic_vector(23 DownTo 0);
	signal controller_5_pixel                        : std_logic;
	signal controller_5_complete                     : std_logic;
	signal controller_5_f_label                      : std_logic_vector(23 DownTo 0);
	signal ph_link_5_8                               : std_logic;
	signal ph_link_5_9                               : std_logic;
	signal ph_link_5_7                               : std_logic;
	signal ph_link_5_6                               : std_logic;
	signal link_5_out_n                              : std_logic;
	signal link_5_out_ne                             : std_logic;
	signal link_5_out_nw                             : std_logic;
	signal link_5_out_s                              : std_logic;
	signal link_5_out_se                             : std_logic;
	signal link_5_out_sw                             : std_logic;
	signal link_5_out_e                              : std_logic;
	signal link_5_out_w                              : std_logic;

	-- controller 6
	signal controller_6_address                      : std_logic_vector(23 DownTo 0);
	signal controller_6_pixel                        : std_logic;
	signal controller_6_complete                     : std_logic;
	signal controller_6_f_label                      : std_logic_vector(23 DownTo 0);
	signal ph_link_6_9                               : std_logic;
	signal ph_link_6_b10                             : std_logic;
	signal ph_link_6_8                               : std_logic;
	signal ph_link_6_b8                              : std_logic;
	signal link_6_out_n                              : std_logic;
	signal link_6_out_ne                             : std_logic;
	signal link_6_out_nw                             : std_logic;
	signal link_6_out_s                              : std_logic;
	signal link_6_out_se                             : std_logic;
	signal link_6_out_sw                             : std_logic;
	signal link_6_out_e                              : std_logic;
	signal link_6_out_w                              : std_logic;

	-- controller b8
	signal controller_b8_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b8_pixel                       : std_logic;
	signal controller_b8_complete                    : std_logic;
	signal controller_b8_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b8_ne                             : std_logic;
	signal ph_link_b8_b10                            : std_logic;
	signal ph_loop_b8_se                             : std_logic;
	signal ph_link_b8_9                              : std_logic;
	signal ph_loop_b8_e                              : std_logic;
	signal link_b8_out_n                             : std_logic;
	signal link_b8_out_ne                            : std_logic;
	signal link_b8_out_nw                            : std_logic;
	signal link_b8_out_s                             : std_logic;
	signal link_b8_out_se                            : std_logic;
	signal link_b8_out_sw                            : std_logic;
	signal link_b8_out_e                             : std_logic;
	signal link_b8_out_w                             : std_logic;

	-- controller b9
	signal controller_b9_address                     : std_logic_vector(23 DownTo 0);
	signal controller_b9_pixel                       : std_logic;
	signal controller_b9_complete                    : std_logic;
	signal controller_b9_f_label                     : std_logic_vector(23 DownTo 0);
	signal ph_loop_b9_nw                             : std_logic;
	signal ph_link_b9_b11                            : std_logic;
	signal ph_link_b9_b12                            : std_logic;
	signal ph_loop_b9_sw                             : std_logic;
	signal ph_link_b9_7                              : std_logic;
	signal ph_loop_b9_w                              : std_logic;
	signal link_b9_out_n                             : std_logic;
	signal link_b9_out_ne                            : std_logic;
	signal link_b9_out_nw                            : std_logic;
	signal link_b9_out_s                             : std_logic;
	signal link_b9_out_se                            : std_logic;
	signal link_b9_out_sw                            : std_logic;
	signal link_b9_out_e                             : std_logic;
	signal link_b9_out_w                             : std_logic;

	-- controller 7
	signal controller_7_address                      : std_logic_vector(23 DownTo 0);
	signal controller_7_pixel                        : std_logic;
	signal controller_7_complete                     : std_logic;
	signal controller_7_f_label                      : std_logic_vector(23 DownTo 0);
	signal ph_link_7_b12                             : std_logic;
	signal ph_link_7_b13                             : std_logic;
	signal ph_link_7_b11                             : std_logic;
	signal ph_link_7_8                               : std_logic;
	signal link_7_out_n                              : std_logic;
	signal link_7_out_ne                             : std_logic;
	signal link_7_out_nw                             : std_logic;
	signal link_7_out_s                              : std_logic;
	signal link_7_out_se                             : std_logic;
	signal link_7_out_sw                             : std_logic;
	signal link_7_out_e                              : std_logic;
	signal link_7_out_w                              : std_logic;

	-- controller 8
	signal controller_8_address                      : std_logic_vector(23 DownTo 0);
	signal controller_8_pixel                        : std_logic;
	signal controller_8_complete                     : std_logic;
	signal controller_8_f_label                      : std_logic_vector(23 DownTo 0);
	signal ph_link_8_b13                             : std_logic;
	signal ph_link_8_b14                             : std_logic;
	signal ph_link_8_b12                             : std_logic;
	signal ph_link_8_9                               : std_logic;
	signal link_8_out_n                              : std_logic;
	signal link_8_out_ne                             : std_logic;
	signal link_8_out_nw                             : std_logic;
	signal link_8_out_s                              : std_logic;
	signal link_8_out_se                             : std_logic;
	signal link_8_out_sw                             : std_logic;
	signal link_8_out_e                              : std_logic;
	signal link_8_out_w                              : std_logic;

	-- controller 9
	signal controller_9_address                      : std_logic_vector(23 DownTo 0);
	signal controller_9_pixel                        : std_logic;
	signal controller_9_complete                     : std_logic;
	signal controller_9_f_label                      : std_logic_vector(23 DownTo 0);
	signal ph_link_9_b14                             : std_logic;
	signal ph_link_9_b15                             : std_logic;
	signal ph_link_9_b13                             : std_logic;
	signal ph_link_9_b10                             : std_logic;
	signal link_9_out_n                              : std_logic;
	signal link_9_out_ne                             : std_logic;
	signal link_9_out_nw                             : std_logic;
	signal link_9_out_s                              : std_logic;
	signal link_9_out_se                             : std_logic;
	signal link_9_out_sw                             : std_logic;
	signal link_9_out_e                              : std_logic;
	signal link_9_out_w                              : std_logic;

	-- controller b10
	signal controller_b10_address                    : std_logic_vector(23 DownTo 0);
	signal controller_b10_pixel                      : std_logic;
	signal controller_b10_complete                   : std_logic;
	signal controller_b10_f_label                    : std_logic_vector(23 DownTo 0);
	signal ph_loop_b10_ne                            : std_logic;
	signal ph_link_b10_b15                           : std_logic;
	signal ph_loop_b10_se                            : std_logic;
	signal ph_link_b10_b14                           : std_logic;
	signal ph_loop_b10_e                             : std_logic;
	signal link_b10_out_n                            : std_logic;
	signal link_b10_out_ne                           : std_logic;
	signal link_b10_out_nw                           : std_logic;
	signal link_b10_out_s                            : std_logic;
	signal link_b10_out_se                           : std_logic;
	signal link_b10_out_sw                           : std_logic;
	signal link_b10_out_e                            : std_logic;
	signal link_b10_out_w                            : std_logic;

	-- controller b11
	signal controller_b11_address                    : std_logic_vector(23 DownTo 0);
	signal controller_b11_pixel                      : std_logic;
	signal controller_b11_complete                   : std_logic;
	signal controller_b11_f_label                    : std_logic_vector(23 DownTo 0);
	signal ph_loop_b11_nw                            : std_logic;
	signal ph_loop_b11_s                             : std_logic;
	signal ph_loop_b11_se                            : std_logic;
	signal ph_loop_b11_sw                            : std_logic;
	signal ph_link_b11_b12                           : std_logic;
	signal ph_loop_b11_w                             : std_logic;
	signal link_b11_out_n                            : std_logic;
	signal link_b11_out_ne                           : std_logic;
	signal link_b11_out_nw                           : std_logic;
	signal link_b11_out_s                            : std_logic;
	signal link_b11_out_se                           : std_logic;
	signal link_b11_out_sw                           : std_logic;
	signal link_b11_out_e                            : std_logic;
	signal link_b11_out_w                            : std_logic;

	-- controller b12
	signal controller_b12_address                    : std_logic_vector(23 DownTo 0);
	signal controller_b12_pixel                      : std_logic;
	signal controller_b12_complete                   : std_logic;
	signal controller_b12_f_label                    : std_logic_vector(23 DownTo 0);
	signal ph_loop_b12_s                             : std_logic;
	signal ph_loop_b12_se                            : std_logic;
	signal ph_loop_b12_sw                            : std_logic;
	signal ph_link_b12_b13                           : std_logic;
	signal link_b12_out_n                            : std_logic;
	signal link_b12_out_ne                           : std_logic;
	signal link_b12_out_nw                           : std_logic;
	signal link_b12_out_s                            : std_logic;
	signal link_b12_out_se                           : std_logic;
	signal link_b12_out_sw                           : std_logic;
	signal link_b12_out_e                            : std_logic;
	signal link_b12_out_w                            : std_logic;

	-- controller b13
	signal controller_b13_address                    : std_logic_vector(23 DownTo 0);
	signal controller_b13_pixel                      : std_logic;
	signal controller_b13_complete                   : std_logic;
	signal controller_b13_f_label                    : std_logic_vector(23 DownTo 0);
	signal ph_loop_b13_s                             : std_logic;
	signal ph_loop_b13_se                            : std_logic;
	signal ph_loop_b13_sw                            : std_logic;
	signal ph_link_b13_b14                           : std_logic;
	signal link_b13_out_n                            : std_logic;
	signal link_b13_out_ne                           : std_logic;
	signal link_b13_out_nw                           : std_logic;
	signal link_b13_out_s                            : std_logic;
	signal link_b13_out_se                           : std_logic;
	signal link_b13_out_sw                           : std_logic;
	signal link_b13_out_e                            : std_logic;
	signal link_b13_out_w                            : std_logic;

	-- controller b14
	signal controller_b14_address                    : std_logic_vector(23 DownTo 0);
	signal controller_b14_pixel                      : std_logic;
	signal controller_b14_complete                   : std_logic;
	signal controller_b14_f_label                    : std_logic_vector(23 DownTo 0);
	signal ph_loop_b14_s                             : std_logic;
	signal ph_loop_b14_se                            : std_logic;
	signal ph_loop_b14_sw                            : std_logic;
	signal ph_link_b14_b15                           : std_logic;
	signal link_b14_out_n                            : std_logic;
	signal link_b14_out_ne                           : std_logic;
	signal link_b14_out_nw                           : std_logic;
	signal link_b14_out_s                            : std_logic;
	signal link_b14_out_se                           : std_logic;
	signal link_b14_out_sw                           : std_logic;
	signal link_b14_out_e                            : std_logic;
	signal link_b14_out_w                            : std_logic;

	-- controller b15
	signal controller_b15_address                    : std_logic_vector(23 DownTo 0);
	signal controller_b15_pixel                      : std_logic;
	signal controller_b15_complete                   : std_logic;
	signal controller_b15_f_label                    : std_logic_vector(23 DownTo 0);
	signal ph_loop_b15_ne                            : std_logic;
	signal ph_loop_b15_s                             : std_logic;
	signal ph_loop_b15_se                            : std_logic;
	signal ph_loop_b15_sw                            : std_logic;
	signal ph_loop_b15_e                             : std_logic;
	signal link_b15_out_n                            : std_logic;
	signal link_b15_out_ne                           : std_logic;
	signal link_b15_out_nw                           : std_logic;
	signal link_b15_out_s                            : std_logic;
	signal link_b15_out_se                           : std_logic;
	signal link_b15_out_sw                           : std_logic;
	signal link_b15_out_e                            : std_logic;
	signal link_b15_out_w                            : std_logic;


begin

	------------------------------------------------------------------------------------------
	--
	-- controllers
	--
	-- all controllers and signals are linked here
	-- 
	------------------------------------------------------------------------------------------

	-- controller b0 decleration
	controller_b0                : link_controller port map (  controller_clk,
	                                                           controller_b0_address,
	                                                           controller_b0_pixel,
	                                                           ph_loop_b0_n,
	                                                           ph_loop_b0_ne,
	                                                           ph_loop_b0_nw,
	                                                           ph_link_b0_b5,
	                                                           ph_link_b0_1,
	                                                           ph_loop_b0_sw,
	                                                           ph_link_b0_b1,
	                                                           ph_loop_b0_w,
	                                                           link_b0_out_n,
	                                                           link_b0_out_ne,
	                                                           link_b0_out_nw,
	                                                           link_b0_out_s,
	                                                           link_b0_out_se,
	                                                           link_b0_out_sw,
	                                                           link_b0_out_e,
	                                                           link_b0_out_w,
	                                                           controller_b0_complete,
	                                                           controller_b0_f_label
	                                                        );
	-- controller b1 decleration
	controller_b1                : link_controller port map (  controller_clk,
	                                                           controller_b1_address,
	                                                           controller_b1_pixel,
	                                                           ph_loop_b1_n,
	                                                           ph_loop_b1_ne,
	                                                           ph_loop_b1_nw,
	                                                           ph_link_b1_1,
	                                                           ph_link_b1_2,
	                                                           ph_link_b1_b5,
	                                                           ph_link_b1_b2,
	                                                           ph_link_b0_b1,
	                                                           link_b1_out_n,
	                                                           link_b1_out_ne,
	                                                           link_b1_out_nw,
	                                                           link_b1_out_s,
	                                                           link_b1_out_se,
	                                                           link_b1_out_sw,
	                                                           link_b1_out_e,
	                                                           link_b1_out_w,
	                                                           controller_b1_complete,
	                                                           controller_b1_f_label
	                                                        );
	-- controller b2 decleration
	controller_b2                : link_controller port map (  controller_clk,
	                                                           controller_b2_address,
	                                                           controller_b2_pixel,
	                                                           ph_loop_b2_n,
	                                                           ph_loop_b2_ne,
	                                                           ph_loop_b2_nw,
	                                                           ph_link_b2_2,
	                                                           ph_link_b2_3,
	                                                           ph_link_b2_1,
	                                                           ph_link_b2_b3,
	                                                           ph_link_b1_b2,
	                                                           link_b2_out_n,
	                                                           link_b2_out_ne,
	                                                           link_b2_out_nw,
	                                                           link_b2_out_s,
	                                                           link_b2_out_se,
	                                                           link_b2_out_sw,
	                                                           link_b2_out_e,
	                                                           link_b2_out_w,
	                                                           controller_b2_complete,
	                                                           controller_b2_f_label
	                                                        );
	-- controller b3 decleration
	controller_b3                : link_controller port map (  controller_clk,
	                                                           controller_b3_address,
	                                                           controller_b3_pixel,
	                                                           ph_loop_b3_n,
	                                                           ph_loop_b3_ne,
	                                                           ph_loop_b3_nw,
	                                                           ph_link_b3_3,
	                                                           ph_link_b3_b6,
	                                                           ph_link_b3_2,
	                                                           ph_link_b3_b4,
	                                                           ph_link_b2_b3,
	                                                           link_b3_out_n,
	                                                           link_b3_out_ne,
	                                                           link_b3_out_nw,
	                                                           link_b3_out_s,
	                                                           link_b3_out_se,
	                                                           link_b3_out_sw,
	                                                           link_b3_out_e,
	                                                           link_b3_out_w,
	                                                           controller_b3_complete,
	                                                           controller_b3_f_label
	                                                        );
	-- controller b4 decleration
	controller_b4                : link_controller port map (  controller_clk,
	                                                           controller_b4_address,
	                                                           controller_b4_pixel,
	                                                           ph_loop_b4_n,
	                                                           ph_loop_b4_ne,
	                                                           ph_loop_b4_nw,
	                                                           ph_link_b4_b6,
	                                                           ph_loop_b4_se,
	                                                           ph_link_b4_3,
	                                                           ph_loop_b4_e,
	                                                           ph_link_b3_b4,
	                                                           link_b4_out_n,
	                                                           link_b4_out_ne,
	                                                           link_b4_out_nw,
	                                                           link_b4_out_s,
	                                                           link_b4_out_se,
	                                                           link_b4_out_sw,
	                                                           link_b4_out_e,
	                                                           link_b4_out_w,
	                                                           controller_b4_complete,
	                                                           controller_b4_f_label
	                                                        );
	-- controller b5 decleration
	controller_b5                : link_controller port map (  controller_clk,
	                                                           controller_b5_address,
	                                                           controller_b5_pixel,
	                                                           ph_link_b0_b5,
	                                                           ph_link_b1_b5,
	                                                           ph_loop_b5_nw,
	                                                           ph_link_b5_b7,
	                                                           ph_link_b5_4,
	                                                           ph_loop_b5_sw,
	                                                           ph_link_b5_1,
	                                                           ph_loop_b5_w,
	                                                           link_b5_out_n,
	                                                           link_b5_out_ne,
	                                                           link_b5_out_nw,
	                                                           link_b5_out_s,
	                                                           link_b5_out_se,
	                                                           link_b5_out_sw,
	                                                           link_b5_out_e,
	                                                           link_b5_out_w,
	                                                           controller_b5_complete,
	                                                           controller_b5_f_label
	                                                        );
	-- controller 1 decleration
	controller_1                 : link_controller port map (  controller_clk,
	                                                           controller_1_address,
	                                                           controller_1_pixel,
	                                                           ph_link_b1_1,
	                                                           ph_link_b2_1,
	                                                           ph_link_b0_1,
	                                                           ph_link_1_4,
	                                                           ph_link_1_5,
	                                                           ph_link_1_b7,
	                                                           ph_link_1_2,
	                                                           ph_link_b5_1,
	                                                           link_1_out_n,
	                                                           link_1_out_ne,
	                                                           link_1_out_nw,
	                                                           link_1_out_s,
	                                                           link_1_out_se,
	                                                           link_1_out_sw,
	                                                           link_1_out_e,
	                                                           link_1_out_w,
	                                                           controller_1_complete,
	                                                           controller_1_f_label
	                                                        );
	-- controller 2 decleration
	controller_2                 : link_controller port map (  controller_clk,
	                                                           controller_2_address,
	                                                           controller_2_pixel,
	                                                           ph_link_b2_2,
	                                                           ph_link_b3_2,
	                                                           ph_link_b1_2,
	                                                           ph_link_2_5,
	                                                           ph_link_2_6,
	                                                           ph_link_2_4,
	                                                           ph_link_2_3,
	                                                           ph_link_1_2,
	                                                           link_2_out_n,
	                                                           link_2_out_ne,
	                                                           link_2_out_nw,
	                                                           link_2_out_s,
	                                                           link_2_out_se,
	                                                           link_2_out_sw,
	                                                           link_2_out_e,
	                                                           link_2_out_w,
	                                                           controller_2_complete,
	                                                           controller_2_f_label
	                                                        );
	-- controller 3 decleration
	controller_3                 : link_controller port map (  controller_clk,
	                                                           controller_3_address,
	                                                           controller_3_pixel,
	                                                           ph_link_b3_3,
	                                                           ph_link_b4_3,
	                                                           ph_link_b2_3,
	                                                           ph_link_3_6,
	                                                           ph_link_3_b8,
	                                                           ph_link_3_5,
	                                                           ph_link_3_b6,
	                                                           ph_link_2_3,
	                                                           link_3_out_n,
	                                                           link_3_out_ne,
	                                                           link_3_out_nw,
	                                                           link_3_out_s,
	                                                           link_3_out_se,
	                                                           link_3_out_sw,
	                                                           link_3_out_e,
	                                                           link_3_out_w,
	                                                           controller_3_complete,
	                                                           controller_3_f_label
	                                                        );
	-- controller b6 decleration
	controller_b6                : link_controller port map (  controller_clk,
	                                                           controller_b6_address,
	                                                           controller_b6_pixel,
	                                                           ph_link_b4_b6,
	                                                           ph_loop_b6_ne,
	                                                           ph_link_b3_b6,
	                                                           ph_link_b6_b8,
	                                                           ph_loop_b6_se,
	                                                           ph_link_b6_6,
	                                                           ph_loop_b6_e,
	                                                           ph_link_3_b6,
	                                                           link_b6_out_n,
	                                                           link_b6_out_ne,
	                                                           link_b6_out_nw,
	                                                           link_b6_out_s,
	                                                           link_b6_out_se,
	                                                           link_b6_out_sw,
	                                                           link_b6_out_e,
	                                                           link_b6_out_w,
	                                                           controller_b6_complete,
	                                                           controller_b6_f_label
	                                                        );
	-- controller b7 decleration
	controller_b7                : link_controller port map (  controller_clk,
	                                                           controller_b7_address,
	                                                           controller_b7_pixel,
	                                                           ph_link_b5_b7,
	                                                           ph_link_1_b7,
	                                                           ph_loop_b7_nw,
	                                                           ph_link_b7_b9,
	                                                           ph_link_b7_7,
	                                                           ph_loop_b7_sw,
	                                                           ph_link_b7_4,
	                                                           ph_loop_b7_w,
	                                                           link_b7_out_n,
	                                                           link_b7_out_ne,
	                                                           link_b7_out_nw,
	                                                           link_b7_out_s,
	                                                           link_b7_out_se,
	                                                           link_b7_out_sw,
	                                                           link_b7_out_e,
	                                                           link_b7_out_w,
	                                                           controller_b7_complete,
	                                                           controller_b7_f_label
	                                                        );
	-- controller 4 decleration
	controller_4                 : link_controller port map (  controller_clk,
	                                                           controller_4_address,
	                                                           controller_4_pixel,
	                                                           ph_link_1_4,
	                                                           ph_link_2_4,
	                                                           ph_link_b5_4,
	                                                           ph_link_4_7,
	                                                           ph_link_4_8,
	                                                           ph_link_4_b9,
	                                                           ph_link_4_5,
	                                                           ph_link_b7_4,
	                                                           link_4_out_n,
	                                                           link_4_out_ne,
	                                                           link_4_out_nw,
	                                                           link_4_out_s,
	                                                           link_4_out_se,
	                                                           link_4_out_sw,
	                                                           link_4_out_e,
	                                                           link_4_out_w,
	                                                           controller_4_complete,
	                                                           controller_4_f_label
	                                                        );
	-- controller 5 decleration
	controller_5                 : link_controller port map (  controller_clk,
	                                                           controller_5_address,
	                                                           controller_5_pixel,
	                                                           ph_link_2_5,
	                                                           ph_link_3_5,
	                                                           ph_link_1_5,
	                                                           ph_link_5_8,
	                                                           ph_link_5_9,
	                                                           ph_link_5_7,
	                                                           ph_link_5_6,
	                                                           ph_link_4_5,
	                                                           link_5_out_n,
	                                                           link_5_out_ne,
	                                                           link_5_out_nw,
	                                                           link_5_out_s,
	                                                           link_5_out_se,
	                                                           link_5_out_sw,
	                                                           link_5_out_e,
	                                                           link_5_out_w,
	                                                           controller_5_complete,
	                                                           controller_5_f_label
	                                                        );
	-- controller 6 decleration
	controller_6                 : link_controller port map (  controller_clk,
	                                                           controller_6_address,
	                                                           controller_6_pixel,
	                                                           ph_link_3_6,
	                                                           ph_link_b6_6,
	                                                           ph_link_2_6,
	                                                           ph_link_6_9,
	                                                           ph_link_6_b10,
	                                                           ph_link_6_8,
	                                                           ph_link_6_b8,
	                                                           ph_link_5_6,
	                                                           link_6_out_n,
	                                                           link_6_out_ne,
	                                                           link_6_out_nw,
	                                                           link_6_out_s,
	                                                           link_6_out_se,
	                                                           link_6_out_sw,
	                                                           link_6_out_e,
	                                                           link_6_out_w,
	                                                           controller_6_complete,
	                                                           controller_6_f_label
	                                                        );
	-- controller b8 decleration
	controller_b8                : link_controller port map (  controller_clk,
	                                                           controller_b8_address,
	                                                           controller_b8_pixel,
	                                                           ph_link_b6_b8,
	                                                           ph_loop_b8_ne,
	                                                           ph_link_3_b8,
	                                                           ph_link_b8_b10,
	                                                           ph_loop_b8_se,
	                                                           ph_link_b8_9,
	                                                           ph_loop_b8_e,
	                                                           ph_link_6_b8,
	                                                           link_b8_out_n,
	                                                           link_b8_out_ne,
	                                                           link_b8_out_nw,
	                                                           link_b8_out_s,
	                                                           link_b8_out_se,
	                                                           link_b8_out_sw,
	                                                           link_b8_out_e,
	                                                           link_b8_out_w,
	                                                           controller_b8_complete,
	                                                           controller_b8_f_label
	                                                        );
	-- controller b9 decleration
	controller_b9                : link_controller port map (  controller_clk,
	                                                           controller_b9_address,
	                                                           controller_b9_pixel,
	                                                           ph_link_b7_b9,
	                                                           ph_link_4_b9,
	                                                           ph_loop_b9_nw,
	                                                           ph_link_b9_b11,
	                                                           ph_link_b9_b12,
	                                                           ph_loop_b9_sw,
	                                                           ph_link_b9_7,
	                                                           ph_loop_b9_w,
	                                                           link_b9_out_n,
	                                                           link_b9_out_ne,
	                                                           link_b9_out_nw,
	                                                           link_b9_out_s,
	                                                           link_b9_out_se,
	                                                           link_b9_out_sw,
	                                                           link_b9_out_e,
	                                                           link_b9_out_w,
	                                                           controller_b9_complete,
	                                                           controller_b9_f_label
	                                                        );
	-- controller 7 decleration
	controller_7                 : link_controller port map (  controller_clk,
	                                                           controller_7_address,
	                                                           controller_7_pixel,
	                                                           ph_link_4_7,
	                                                           ph_link_5_7,
	                                                           ph_link_b7_7,
	                                                           ph_link_7_b12,
	                                                           ph_link_7_b13,
	                                                           ph_link_7_b11,
	                                                           ph_link_7_8,
	                                                           ph_link_b9_7,
	                                                           link_7_out_n,
	                                                           link_7_out_ne,
	                                                           link_7_out_nw,
	                                                           link_7_out_s,
	                                                           link_7_out_se,
	                                                           link_7_out_sw,
	                                                           link_7_out_e,
	                                                           link_7_out_w,
	                                                           controller_7_complete,
	                                                           controller_7_f_label
	                                                        );
	-- controller 8 decleration
	controller_8                 : link_controller port map (  controller_clk,
	                                                           controller_8_address,
	                                                           controller_8_pixel,
	                                                           ph_link_5_8,
	                                                           ph_link_6_8,
	                                                           ph_link_4_8,
	                                                           ph_link_8_b13,
	                                                           ph_link_8_b14,
	                                                           ph_link_8_b12,
	                                                           ph_link_8_9,
	                                                           ph_link_7_8,
	                                                           link_8_out_n,
	                                                           link_8_out_ne,
	                                                           link_8_out_nw,
	                                                           link_8_out_s,
	                                                           link_8_out_se,
	                                                           link_8_out_sw,
	                                                           link_8_out_e,
	                                                           link_8_out_w,
	                                                           controller_8_complete,
	                                                           controller_8_f_label
	                                                        );
	-- controller 9 decleration
	controller_9                 : link_controller port map (  controller_clk,
	                                                           controller_9_address,
	                                                           controller_9_pixel,
	                                                           ph_link_6_9,
	                                                           ph_link_b8_9,
	                                                           ph_link_5_9,
	                                                           ph_link_9_b14,
	                                                           ph_link_9_b15,
	                                                           ph_link_9_b13,
	                                                           ph_link_9_b10,
	                                                           ph_link_8_9,
	                                                           link_9_out_n,
	                                                           link_9_out_ne,
	                                                           link_9_out_nw,
	                                                           link_9_out_s,
	                                                           link_9_out_se,
	                                                           link_9_out_sw,
	                                                           link_9_out_e,
	                                                           link_9_out_w,
	                                                           controller_9_complete,
	                                                           controller_9_f_label
	                                                        );
	-- controller b10 decleration
	controller_b10               : link_controller port map (  controller_clk,
	                                                           controller_b10_address,
	                                                           controller_b10_pixel,
	                                                           ph_link_b8_b10,
	                                                           ph_loop_b10_ne,
	                                                           ph_link_6_b10,
	                                                           ph_link_b10_b15,
	                                                           ph_loop_b10_se,
	                                                           ph_link_b10_b14,
	                                                           ph_loop_b10_e,
	                                                           ph_link_9_b10,
	                                                           link_b10_out_n,
	                                                           link_b10_out_ne,
	                                                           link_b10_out_nw,
	                                                           link_b10_out_s,
	                                                           link_b10_out_se,
	                                                           link_b10_out_sw,
	                                                           link_b10_out_e,
	                                                           link_b10_out_w,
	                                                           controller_b10_complete,
	                                                           controller_b10_f_label
	                                                        );
	-- controller b11 decleration
	controller_b11               : link_controller port map (  controller_clk,
	                                                           controller_b11_address,
	                                                           controller_b11_pixel,
	                                                           ph_link_b9_b11,
	                                                           ph_link_7_b11,
	                                                           ph_loop_b11_nw,
	                                                           ph_loop_b11_s,
	                                                           ph_loop_b11_se,
	                                                           ph_loop_b11_sw,
	                                                           ph_link_b11_b12,
	                                                           ph_loop_b11_w,
	                                                           link_b11_out_n,
	                                                           link_b11_out_ne,
	                                                           link_b11_out_nw,
	                                                           link_b11_out_s,
	                                                           link_b11_out_se,
	                                                           link_b11_out_sw,
	                                                           link_b11_out_e,
	                                                           link_b11_out_w,
	                                                           controller_b11_complete,
	                                                           controller_b11_f_label
	                                                        );
	-- controller b12 decleration
	controller_b12               : link_controller port map (  controller_clk,
	                                                           controller_b12_address,
	                                                           controller_b12_pixel,
	                                                           ph_link_7_b12,
	                                                           ph_link_8_b12,
	                                                           ph_link_b9_b12,
	                                                           ph_loop_b12_s,
	                                                           ph_loop_b12_se,
	                                                           ph_loop_b12_sw,
	                                                           ph_link_b12_b13,
	                                                           ph_link_b11_b12,
	                                                           link_b12_out_n,
	                                                           link_b12_out_ne,
	                                                           link_b12_out_nw,
	                                                           link_b12_out_s,
	                                                           link_b12_out_se,
	                                                           link_b12_out_sw,
	                                                           link_b12_out_e,
	                                                           link_b12_out_w,
	                                                           controller_b12_complete,
	                                                           controller_b12_f_label
	                                                        );
	-- controller b13 decleration
	controller_b13               : link_controller port map (  controller_clk,
	                                                           controller_b13_address,
	                                                           controller_b13_pixel,
	                                                           ph_link_8_b13,
	                                                           ph_link_9_b13,
	                                                           ph_link_7_b13,
	                                                           ph_loop_b13_s,
	                                                           ph_loop_b13_se,
	                                                           ph_loop_b13_sw,
	                                                           ph_link_b13_b14,
	                                                           ph_link_b12_b13,
	                                                           link_b13_out_n,
	                                                           link_b13_out_ne,
	                                                           link_b13_out_nw,
	                                                           link_b13_out_s,
	                                                           link_b13_out_se,
	                                                           link_b13_out_sw,
	                                                           link_b13_out_e,
	                                                           link_b13_out_w,
	                                                           controller_b13_complete,
	                                                           controller_b13_f_label
	                                                        );
	-- controller b14 decleration
	controller_b14               : link_controller port map (  controller_clk,
	                                                           controller_b14_address,
	                                                           controller_b14_pixel,
	                                                           ph_link_9_b14,
	                                                           ph_link_b10_b14,
	                                                           ph_link_8_b14,
	                                                           ph_loop_b14_s,
	                                                           ph_loop_b14_se,
	                                                           ph_loop_b14_sw,
	                                                           ph_link_b14_b15,
	                                                           ph_link_b13_b14,
	                                                           link_b14_out_n,
	                                                           link_b14_out_ne,
	                                                           link_b14_out_nw,
	                                                           link_b14_out_s,
	                                                           link_b14_out_se,
	                                                           link_b14_out_sw,
	                                                           link_b14_out_e,
	                                                           link_b14_out_w,
	                                                           controller_b14_complete,
	                                                           controller_b14_f_label
	                                                        );
	-- controller b15 decleration
	controller_b15               : link_controller port map (  controller_clk,
	                                                           controller_b15_address,
	                                                           controller_b15_pixel,
	                                                           ph_link_b10_b15,
	                                                           ph_loop_b15_ne,
	                                                           ph_link_9_b15,
	                                                           ph_loop_b15_s,
	                                                           ph_loop_b15_se,
	                                                           ph_loop_b15_sw,
	                                                           ph_loop_b15_e,
	                                                           ph_link_b14_b15,
	                                                           link_b15_out_n,
	                                                           link_b15_out_ne,
	                                                           link_b15_out_nw,
	                                                           link_b15_out_s,
	                                                           link_b15_out_se,
	                                                           link_b15_out_sw,
	                                                           link_b15_out_e,
	                                                           link_b15_out_w,
	                                                           controller_b15_complete,
	                                                           controller_b15_f_label
	                                                        );
	------------------------------------------------------------------------------------------
	--
	-- physical links
	--
	-- physical links I/O defined here
	-- 
	------------------------------------------------------------------------------------------

	link_l_b0_n           : link_physical port map (   link_b0_out_n           , link_b0_out_n         , ph_loop_b0_n         );
	link_l_b0_ne          : link_physical port map (   link_b0_out_ne          , link_b0_out_ne        , ph_loop_b0_ne        );
	link_l_b0_nw          : link_physical port map (   link_b0_out_nw          , link_b0_out_nw        , ph_loop_b0_nw        );
	link_b0_b5            : link_physical port map (   link_b0_out_s           , link_b5_out_n         , ph_link_b0_b5        );
	link_b0_1             : link_physical port map (   link_b0_out_se          , link_1_out_nw         , ph_link_b0_1         );
	link_l_b0_sw          : link_physical port map (   link_b0_out_sw          , link_b0_out_sw        , ph_loop_b0_sw        );
	link_b0_b1            : link_physical port map (   link_b0_out_e           , link_b1_out_w         , ph_link_b0_b1        );
	link_l_b0_w           : link_physical port map (   link_b0_out_w           , link_b0_out_w         , ph_loop_b0_w         );

	link_l_b1_n           : link_physical port map (   link_b1_out_n           , link_b1_out_n         , ph_loop_b1_n         );
	link_l_b1_ne          : link_physical port map (   link_b1_out_ne          , link_b1_out_ne        , ph_loop_b1_ne        );
	link_l_b1_nw          : link_physical port map (   link_b1_out_nw          , link_b1_out_nw        , ph_loop_b1_nw        );
	link_b1_1             : link_physical port map (   link_b1_out_s           , link_1_out_n          , ph_link_b1_1         );
	link_b1_2             : link_physical port map (   link_b1_out_se          , link_2_out_nw         , ph_link_b1_2         );
	link_b1_b5            : link_physical port map (   link_b1_out_sw          , link_b5_out_ne        , ph_link_b1_b5        );
	link_b1_b2            : link_physical port map (   link_b1_out_e           , link_b2_out_w         , ph_link_b1_b2        );

	link_l_b2_n           : link_physical port map (   link_b2_out_n           , link_b2_out_n         , ph_loop_b2_n         );
	link_l_b2_ne          : link_physical port map (   link_b2_out_ne          , link_b2_out_ne        , ph_loop_b2_ne        );
	link_l_b2_nw          : link_physical port map (   link_b2_out_nw          , link_b2_out_nw        , ph_loop_b2_nw        );
	link_b2_2             : link_physical port map (   link_b2_out_s           , link_2_out_n          , ph_link_b2_2         );
	link_b2_3             : link_physical port map (   link_b2_out_se          , link_3_out_nw         , ph_link_b2_3         );
	link_b2_1             : link_physical port map (   link_b2_out_sw          , link_1_out_ne         , ph_link_b2_1         );
	link_b2_b3            : link_physical port map (   link_b2_out_e           , link_b3_out_w         , ph_link_b2_b3        );

	link_l_b3_n           : link_physical port map (   link_b3_out_n           , link_b3_out_n         , ph_loop_b3_n         );
	link_l_b3_ne          : link_physical port map (   link_b3_out_ne          , link_b3_out_ne        , ph_loop_b3_ne        );
	link_l_b3_nw          : link_physical port map (   link_b3_out_nw          , link_b3_out_nw        , ph_loop_b3_nw        );
	link_b3_3             : link_physical port map (   link_b3_out_s           , link_3_out_n          , ph_link_b3_3         );
	link_b3_b6            : link_physical port map (   link_b3_out_se          , link_b6_out_nw        , ph_link_b3_b6        );
	link_b3_2             : link_physical port map (   link_b3_out_sw          , link_2_out_ne         , ph_link_b3_2         );
	link_b3_b4            : link_physical port map (   link_b3_out_e           , link_b4_out_w         , ph_link_b3_b4        );

	link_l_b4_n           : link_physical port map (   link_b4_out_n           , link_b4_out_n         , ph_loop_b4_n         );
	link_l_b4_ne          : link_physical port map (   link_b4_out_ne          , link_b4_out_ne        , ph_loop_b4_ne        );
	link_l_b4_nw          : link_physical port map (   link_b4_out_nw          , link_b4_out_nw        , ph_loop_b4_nw        );
	link_b4_b6            : link_physical port map (   link_b4_out_s           , link_b6_out_n         , ph_link_b4_b6        );
	link_l_b4_se          : link_physical port map (   link_b4_out_se          , link_b4_out_se        , ph_loop_b4_se        );
	link_b4_3             : link_physical port map (   link_b4_out_sw          , link_3_out_ne         , ph_link_b4_3         );
	link_l_b4_e           : link_physical port map (   link_b4_out_e           , link_b4_out_e         , ph_loop_b4_e         );

	link_l_b5_nw          : link_physical port map (   link_b5_out_nw          , link_b5_out_nw        , ph_loop_b5_nw        );
	link_b5_b7            : link_physical port map (   link_b5_out_s           , link_b7_out_n         , ph_link_b5_b7        );
	link_b5_4             : link_physical port map (   link_b5_out_se          , link_4_out_nw         , ph_link_b5_4         );
	link_l_b5_sw          : link_physical port map (   link_b5_out_sw          , link_b5_out_sw        , ph_loop_b5_sw        );
	link_b5_1             : link_physical port map (   link_b5_out_e           , link_1_out_w          , ph_link_b5_1         );
	link_l_b5_w           : link_physical port map (   link_b5_out_w           , link_b5_out_w         , ph_loop_b5_w         );

	link_1_4              : link_physical port map (   link_1_out_s            , link_4_out_n          , ph_link_1_4          );
	link_1_5              : link_physical port map (   link_1_out_se           , link_5_out_nw         , ph_link_1_5          );
	link_1_b7             : link_physical port map (   link_1_out_sw           , link_b7_out_ne        , ph_link_1_b7         );
	link_1_2              : link_physical port map (   link_1_out_e            , link_2_out_w          , ph_link_1_2          );

	link_2_5              : link_physical port map (   link_2_out_s            , link_5_out_n          , ph_link_2_5          );
	link_2_6              : link_physical port map (   link_2_out_se           , link_6_out_nw         , ph_link_2_6          );
	link_2_4              : link_physical port map (   link_2_out_sw           , link_4_out_ne         , ph_link_2_4          );
	link_2_3              : link_physical port map (   link_2_out_e            , link_3_out_w          , ph_link_2_3          );

	link_3_6              : link_physical port map (   link_3_out_s            , link_6_out_n          , ph_link_3_6          );
	link_3_b8             : link_physical port map (   link_3_out_se           , link_b8_out_nw        , ph_link_3_b8         );
	link_3_5              : link_physical port map (   link_3_out_sw           , link_5_out_ne         , ph_link_3_5          );
	link_3_b6             : link_physical port map (   link_3_out_e            , link_b6_out_w         , ph_link_3_b6         );

	link_l_b6_ne          : link_physical port map (   link_b6_out_ne          , link_b6_out_ne        , ph_loop_b6_ne        );
	link_b6_b8            : link_physical port map (   link_b6_out_s           , link_b8_out_n         , ph_link_b6_b8        );
	link_l_b6_se          : link_physical port map (   link_b6_out_se          , link_b6_out_se        , ph_loop_b6_se        );
	link_b6_6             : link_physical port map (   link_b6_out_sw          , link_6_out_ne         , ph_link_b6_6         );
	link_l_b6_e           : link_physical port map (   link_b6_out_e           , link_b6_out_e         , ph_loop_b6_e         );

	link_l_b7_nw          : link_physical port map (   link_b7_out_nw          , link_b7_out_nw        , ph_loop_b7_nw        );
	link_b7_b9            : link_physical port map (   link_b7_out_s           , link_b9_out_n         , ph_link_b7_b9        );
	link_b7_7             : link_physical port map (   link_b7_out_se          , link_7_out_nw         , ph_link_b7_7         );
	link_l_b7_sw          : link_physical port map (   link_b7_out_sw          , link_b7_out_sw        , ph_loop_b7_sw        );
	link_b7_4             : link_physical port map (   link_b7_out_e           , link_4_out_w          , ph_link_b7_4         );
	link_l_b7_w           : link_physical port map (   link_b7_out_w           , link_b7_out_w         , ph_loop_b7_w         );

	link_4_7              : link_physical port map (   link_4_out_s            , link_7_out_n          , ph_link_4_7          );
	link_4_8              : link_physical port map (   link_4_out_se           , link_8_out_nw         , ph_link_4_8          );
	link_4_b9             : link_physical port map (   link_4_out_sw           , link_b9_out_ne        , ph_link_4_b9         );
	link_4_5              : link_physical port map (   link_4_out_e            , link_5_out_w          , ph_link_4_5          );

	link_5_8              : link_physical port map (   link_5_out_s            , link_8_out_n          , ph_link_5_8          );
	link_5_9              : link_physical port map (   link_5_out_se           , link_9_out_nw         , ph_link_5_9          );
	link_5_7              : link_physical port map (   link_5_out_sw           , link_7_out_ne         , ph_link_5_7          );
	link_5_6              : link_physical port map (   link_5_out_e            , link_6_out_w          , ph_link_5_6          );

	link_6_9              : link_physical port map (   link_6_out_s            , link_9_out_n          , ph_link_6_9          );
	link_6_b10            : link_physical port map (   link_6_out_se           , link_b10_out_nw       , ph_link_6_b10        );
	link_6_8              : link_physical port map (   link_6_out_sw           , link_8_out_ne         , ph_link_6_8          );
	link_6_b8             : link_physical port map (   link_6_out_e            , link_b8_out_w         , ph_link_6_b8         );

	link_l_b8_ne          : link_physical port map (   link_b8_out_ne          , link_b8_out_ne        , ph_loop_b8_ne        );
	link_b8_b10           : link_physical port map (   link_b8_out_s           , link_b10_out_n        , ph_link_b8_b10       );
	link_l_b8_se          : link_physical port map (   link_b8_out_se          , link_b8_out_se        , ph_loop_b8_se        );
	link_b8_9             : link_physical port map (   link_b8_out_sw          , link_9_out_ne         , ph_link_b8_9         );
	link_l_b8_e           : link_physical port map (   link_b8_out_e           , link_b8_out_e         , ph_loop_b8_e         );

	link_l_b9_nw          : link_physical port map (   link_b9_out_nw          , link_b9_out_nw        , ph_loop_b9_nw        );
	link_b9_b11           : link_physical port map (   link_b9_out_s           , link_b11_out_n        , ph_link_b9_b11       );
	link_b9_b12           : link_physical port map (   link_b9_out_se          , link_b12_out_nw       , ph_link_b9_b12       );
	link_l_b9_sw          : link_physical port map (   link_b9_out_sw          , link_b9_out_sw        , ph_loop_b9_sw        );
	link_b9_7             : link_physical port map (   link_b9_out_e           , link_7_out_w          , ph_link_b9_7         );
	link_l_b9_w           : link_physical port map (   link_b9_out_w           , link_b9_out_w         , ph_loop_b9_w         );

	link_7_b12            : link_physical port map (   link_7_out_s            , link_b12_out_n        , ph_link_7_b12        );
	link_7_b13            : link_physical port map (   link_7_out_se           , link_b13_out_nw       , ph_link_7_b13        );
	link_7_b11            : link_physical port map (   link_7_out_sw           , link_b11_out_ne       , ph_link_7_b11        );
	link_7_8              : link_physical port map (   link_7_out_e            , link_8_out_w          , ph_link_7_8          );

	link_8_b13            : link_physical port map (   link_8_out_s            , link_b13_out_n        , ph_link_8_b13        );
	link_8_b14            : link_physical port map (   link_8_out_se           , link_b14_out_nw       , ph_link_8_b14        );
	link_8_b12            : link_physical port map (   link_8_out_sw           , link_b12_out_ne       , ph_link_8_b12        );
	link_8_9              : link_physical port map (   link_8_out_e            , link_9_out_w          , ph_link_8_9          );

	link_9_b14            : link_physical port map (   link_9_out_s            , link_b14_out_n        , ph_link_9_b14        );
	link_9_b15            : link_physical port map (   link_9_out_se           , link_b15_out_nw       , ph_link_9_b15        );
	link_9_b13            : link_physical port map (   link_9_out_sw           , link_b13_out_ne       , ph_link_9_b13        );
	link_9_b10            : link_physical port map (   link_9_out_e            , link_b10_out_w        , ph_link_9_b10        );

	link_l_b10_ne         : link_physical port map (   link_b10_out_ne         , link_b10_out_ne       , ph_loop_b10_ne       );
	link_b10_b15          : link_physical port map (   link_b10_out_s          , link_b15_out_n        , ph_link_b10_b15      );
	link_l_b10_se         : link_physical port map (   link_b10_out_se         , link_b10_out_se       , ph_loop_b10_se       );
	link_b10_b14          : link_physical port map (   link_b10_out_sw         , link_b14_out_ne       , ph_link_b10_b14      );
	link_l_b10_e          : link_physical port map (   link_b10_out_e          , link_b10_out_e        , ph_loop_b10_e        );

	link_l_b11_nw         : link_physical port map (   link_b11_out_nw         , link_b11_out_nw       , ph_loop_b11_nw       );
	link_l_b11_s          : link_physical port map (   link_b11_out_s          , link_b11_out_s        , ph_loop_b11_s        );
	link_l_b11_se         : link_physical port map (   link_b11_out_se         , link_b11_out_se       , ph_loop_b11_se       );
	link_l_b11_sw         : link_physical port map (   link_b11_out_sw         , link_b11_out_sw       , ph_loop_b11_sw       );
	link_b11_b12          : link_physical port map (   link_b11_out_e          , link_b12_out_w        , ph_link_b11_b12      );
	link_l_b11_w          : link_physical port map (   link_b11_out_w          , link_b11_out_w        , ph_loop_b11_w        );

	link_l_b12_s          : link_physical port map (   link_b12_out_s          , link_b12_out_s        , ph_loop_b12_s        );
	link_l_b12_se         : link_physical port map (   link_b12_out_se         , link_b12_out_se       , ph_loop_b12_se       );
	link_l_b12_sw         : link_physical port map (   link_b12_out_sw         , link_b12_out_sw       , ph_loop_b12_sw       );
	link_b12_b13          : link_physical port map (   link_b12_out_e          , link_b13_out_w        , ph_link_b12_b13      );

	link_l_b13_s          : link_physical port map (   link_b13_out_s          , link_b13_out_s        , ph_loop_b13_s        );
	link_l_b13_se         : link_physical port map (   link_b13_out_se         , link_b13_out_se       , ph_loop_b13_se       );
	link_l_b13_sw         : link_physical port map (   link_b13_out_sw         , link_b13_out_sw       , ph_loop_b13_sw       );
	link_b13_b14          : link_physical port map (   link_b13_out_e          , link_b14_out_w        , ph_link_b13_b14      );

	link_l_b14_s          : link_physical port map (   link_b14_out_s          , link_b14_out_s        , ph_loop_b14_s        );
	link_l_b14_se         : link_physical port map (   link_b14_out_se         , link_b14_out_se       , ph_loop_b14_se       );
	link_l_b14_sw         : link_physical port map (   link_b14_out_sw         , link_b14_out_sw       , ph_loop_b14_sw       );
	link_b14_b15          : link_physical port map (   link_b14_out_e          , link_b15_out_w        , ph_link_b14_b15      );

	link_l_b15_ne         : link_physical port map (   link_b15_out_ne         , link_b15_out_ne       , ph_loop_b15_ne       );
	link_l_b15_s          : link_physical port map (   link_b15_out_s          , link_b15_out_s        , ph_loop_b15_s        );
	link_l_b15_se         : link_physical port map (   link_b15_out_se         , link_b15_out_se       , ph_loop_b15_se       );
	link_l_b15_sw         : link_physical port map (   link_b15_out_sw         , link_b15_out_sw       , ph_loop_b15_sw       );
	link_l_b15_e          : link_physical port map (   link_b15_out_e          , link_b15_out_e        , ph_loop_b15_e        );


	process

		variable out_loop : integer := 0;


		procedure clock_link is
		begin

			controller_clk <= '1';
			wait for 1 ns;
			controller_clk <= '0';
			wait for 1 ns;

		end clock_link;

		procedure print_any_label ( print_label : std_logic_vector ) is
		begin

			report ("Printing Lablel:" & std_logic'image(print_label(23))
			                           & std_logic'image(print_label(22))
			                           & std_logic'image(print_label(21))
			                           & std_logic'image(print_label(20))
			                           & std_logic'image(print_label(19))
			                           & std_logic'image(print_label(18))
			                           & std_logic'image(print_label(17))
			                           & std_logic'image(print_label(16))
			                           & std_logic'image(print_label(15))
			                           & std_logic'image(print_label(14))
			                           & std_logic'image(print_label(13))
			                           & std_logic'image(print_label(12))
			                           & std_logic'image(print_label(11))
			                           & std_logic'image(print_label(10))
			                           & std_logic'image(print_label(9))
			                           & std_logic'image(print_label(8))
			                           & std_logic'image(print_label(7))
			                           & std_logic'image(print_label(6))
			                           & std_logic'image(print_label(5))
			                           & std_logic'image(print_label(4))
			                           & std_logic'image(print_label(3))
			                           & std_logic'image(print_label(2))
			                           & std_logic'image(print_label(1))
			                           & std_logic'image(print_label(0)));

		end procedure print_any_label;

		procedure print_all_final_labels is
		begin

			print_any_label(controller_1_f_label);
			print_any_label(controller_2_f_label);
			print_any_label(controller_3_f_label);
			print_any_label(controller_4_f_label);
			print_any_label(controller_5_f_label);
			print_any_label(controller_6_f_label);
			print_any_label(controller_7_f_label);
			print_any_label(controller_8_f_label);
			print_any_label(controller_9_f_label);

		end procedure print_all_final_labels;

		impure function are_all_controllers_complete return std_logic is
			variable result : std_logic := '1';
		begin

			result := result and controller_1_complete;
			result := result and controller_2_complete;
			result := result and controller_3_complete;
			result := result and controller_4_complete;
			result := result and controller_5_complete;
			result := result and controller_6_complete;
			result := result and controller_7_complete;
			result := result and controller_8_complete;
			result := result and controller_9_complete;
			return result;

		end function are_all_controllers_complete;

		begin

			-- set  controller pixel values
			controller_1_pixel         <= '1';
			controller_2_pixel         <= '1';
			controller_3_pixel         <= '1';
			controller_4_pixel         <= '1';
			controller_5_pixel         <= '1';
			controller_6_pixel         <= '1';
			controller_7_pixel         <= '1';
			controller_8_pixel         <= '1';
			controller_9_pixel         <= '1';

			controller_b0_pixel        <= '0';
			controller_b1_pixel        <= '0';
			controller_b2_pixel        <= '0';
			controller_b3_pixel        <= '0';
			controller_b4_pixel        <= '0';
			controller_b5_pixel        <= '0';
			controller_b6_pixel        <= '0';
			controller_b7_pixel        <= '0';
			controller_b8_pixel        <= '0';
			controller_b9_pixel        <= '0';
			controller_b10_pixel       <= '0';
			controller_b11_pixel       <= '0';
			controller_b12_pixel       <= '0';
			controller_b13_pixel       <= '0';
			controller_b14_pixel       <= '0';
			controller_b15_pixel       <= '0';

			wait for 1 ns;

			--set controller addresses
			controller_1_address       <= "000000000000000000000001";
			controller_2_address       <= "000000000000000000000010";
			controller_3_address       <= "000000000000000000000011";
			controller_4_address       <= "000000000000000000000100";
			controller_5_address       <= "000000000000000000000101";
			controller_6_address       <= "000000000000000000000110";
			controller_7_address       <= "000000000000000000000111";
			controller_8_address       <= "000000000000000000001000";
			controller_9_address       <= "000000000000000000001001";

			controller_b0_address      <= "100000000000000000000000";
			controller_b1_address      <= "100000000000000000000000";
			controller_b2_address      <= "100000000000000000000000";
			controller_b3_address      <= "100000000000000000000000";
			controller_b4_address      <= "100000000000000000000000";
			controller_b5_address      <= "100000000000000000000000";
			controller_b6_address      <= "100000000000000000000000";
			controller_b7_address      <= "100000000000000000000000";
			controller_b8_address      <= "100000000000000000000000";
			controller_b9_address      <= "100000000000000000000000";
			controller_b10_address     <= "100000000000000000000000";
			controller_b11_address     <= "100000000000000000000000";
			controller_b12_address     <= "100000000000000000000000";
			controller_b13_address     <= "100000000000000000000000";
			controller_b14_address     <= "100000000000000000000000";
			controller_b15_address     <= "100000000000000000000000";

			wait for 1 ns;

			-- initialize contollers and their links with 3 clock cycles
			clock_link;
			clock_link;
			clock_link;

			while are_all_controllers_complete = '0' loop

				out_loop := out_loop + 1;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;
				clock_link;

			end loop;

			-- print final labels
			report ("Number of Communication Cycles: " & integer'image( out_loop ) );
			print_all_final_labels;

			wait;

		end process;

end tb;

